package com.atguigu.servlet; /**
 * @author xbd
 * @create 2021-06-20 19:57
 */

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

public class ContextServlet1 extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 获取ServletContext对象
        ServletContext context = getServletContext();
        context.setAttribute("key1","value1");
        System.out.println("Context1 中获取域数据key1的值是:"+ context.getAttribute("key1"));
    }
}
